/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * dlSource.java
 *
 * Created on Aug 11, 2010, 4:46:14 PM
 */
package Gui;

import BusinessLogic.BackGroundUtility;
import BusinessLogic.BoothManagement;
import BusinessLogic.DateUtility;
import DTO.Booth;
import DTO.Exhibitor;
import DTO.Zone;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.Vector;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author Tran anh
 * @version 1.0
 */
public class DLBooth extends javax.swing.JDialog implements MouseListener {

    private BoothManagement BoothMag;
    private Vector<Exhibitor> listExhibitor;
    private Vector<Booth> listBooth;
    private Vector<Zone> listZone;
    private DefaultTableModel model;
    private String nameExhibitor;
    private JRadioButton[] rdZone;
    private int index = 0;
    private boolean flag = false;
    private String _idZone = "";

    /** Creates new form dlSource */
    public DLBooth(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        //set background
        ImagePanel iPanel = new ImagePanel(BackGroundUtility.getImage());
        getContentPane().add(iPanel);
        //setlocation for application
        Toolkit toolkit = Toolkit.getDefaultToolkit();
        Dimension dim = toolkit.getScreenSize();
        Dimension dimApp = getSize();
        int pointX = (dim.width - dimApp.width) / 2;
        int pointY = (dim.height - dimApp.height) / 2 - 10;
        setLocation(pointX, pointY);
        //Create object Booth management
        BoothMag = new BoothManagement();
        //initial list Zone
        initZone();

        //call method load list ImportantDate
        listExhibitor = BoothMag.loadExhibitor();
        displayExhibitor();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        grZone = new javax.swing.ButtonGroup();
        pnBackground = new javax.swing.JPanel();
        pnContent = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jList1 = new javax.swing.JList();
        txtSearch = new javax.swing.JTextField();
        jPanel2 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        txtID = new javax.swing.JTextField();
        txtName = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        txtMoneyService = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        txtNumberStaff = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        txtDateCreate = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        cbPriority = new javax.swing.JComboBox();
        jLabel7 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        pnZone = new javax.swing.JPanel();
        jSeparator1 = new javax.swing.JSeparator();
        txtSponsor = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jPanel4 = new javax.swing.JPanel();
        btnPrev = new javax.swing.JButton();
        btnNext = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        btnSave = new javax.swing.JButton();
        btnAdd = new javax.swing.JButton();
        jButton7 = new javax.swing.JButton();
        jButton8 = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        tbBooth = new javax.swing.JTable();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Booth Management");

        pnBackground.setBackground(new java.awt.Color(0, 102, 102));
        pnBackground.setOpaque(false);

        pnContent.setBackground(new java.awt.Color(255, 255, 255));

        jPanel3.setLayout(null);

        jLabel3.setText("Look for:");
        jPanel3.add(jLabel3);
        jLabel3.setBounds(10, 0, 70, 20);

        jList1.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jList1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jList1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                jList1MousePressed(evt);
            }
        });
        jScrollPane2.setViewportView(jList1);

        jPanel3.add(jScrollPane2);
        jScrollPane2.setBounds(10, 50, 150, 300);

        txtSearch.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                txtSearchKeyReleased(evt);
            }
        });
        jPanel3.add(txtSearch);
        txtSearch.setBounds(10, 20, 150, 19);

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Information of Booth"));
        jPanel2.setLayout(null);

        jLabel4.setText("ID");
        jPanel2.add(jLabel4);
        jLabel4.setBounds(50, 30, 60, 14);

        txtID.setEditable(false);
        jPanel2.add(txtID);
        txtID.setBounds(130, 30, 110, 19);
        jPanel2.add(txtName);
        txtName.setBounds(130, 60, 240, 19);

        jLabel2.setText("Name");
        jPanel2.add(jLabel2);
        jLabel2.setBounds(50, 60, 40, 14);

        jLabel5.setText("Money Service");
        jPanel2.add(jLabel5);
        jLabel5.setBounds(50, 120, 80, 14);
        jPanel2.add(txtMoneyService);
        txtMoneyService.setBounds(130, 120, 240, 19);

        jLabel8.setText("Priority");
        jPanel2.add(jLabel8);
        jLabel8.setBounds(50, 150, 65, 14);
        jPanel2.add(txtNumberStaff);
        txtNumberStaff.setBounds(130, 180, 240, 19);

        jLabel1.setText("Number Staff");
        jPanel2.add(jLabel1);
        jLabel1.setBounds(50, 180, 70, 14);

        jLabel12.setText("Date Create");
        jPanel2.add(jLabel12);
        jLabel12.setBounds(50, 210, 70, 14);
        jPanel2.add(txtDateCreate);
        txtDateCreate.setBounds(130, 210, 240, 19);

        jLabel6.setText("Sponsor");
        jPanel2.add(jLabel6);
        jLabel6.setBounds(50, 90, 48, 14);

        cbPriority.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "0", "1", "2", "3", "4", "5" }));
        jPanel2.add(cbPriority);
        cbPriority.setBounds(130, 150, 100, 22);

        jLabel7.setText("Number Booth");
        jPanel2.add(jLabel7);
        jLabel7.setBounds(280, 240, 70, 14);

        jScrollPane3.setBorder(null);

        pnZone.setLayout(null);
        pnZone.add(jSeparator1);
        jSeparator1.setBounds(0, 0, 300, 10);

        jScrollPane3.setViewportView(pnZone);

        jPanel2.add(jScrollPane3);
        jScrollPane3.setBounds(50, 260, 300, 90);
        jPanel2.add(txtSponsor);
        txtSponsor.setBounds(130, 90, 240, 19);

        jLabel9.setText("Zone");
        jPanel2.add(jLabel9);
        jLabel9.setBounds(50, 240, 40, 14);

        jLabel10.setText("Size");
        jPanel2.add(jLabel10);
        jLabel10.setBounds(130, 240, 40, 14);

        jLabel11.setText("Money");
        jPanel2.add(jLabel11);
        jLabel11.setBounds(200, 240, 50, 14);

        jPanel4.setLayout(null);

        btnPrev.setText("Prev");
        btnPrev.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnPrevActionPerformed(evt);
            }
        });
        jPanel4.add(btnPrev);
        btnPrev.setBounds(110, 10, 70, 23);

        btnNext.setText("Next");
        btnNext.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNextActionPerformed(evt);
            }
        });
        jPanel4.add(btnNext);
        btnNext.setBounds(200, 10, 70, 23);

        jButton3.setText("First");
        jPanel4.add(jButton3);
        jButton3.setBounds(290, 10, 70, 23);

        jButton4.setText("Last");
        jPanel4.add(jButton4);
        jButton4.setBounds(380, 10, 70, 23);

        btnSave.setText("Save");
        btnSave.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSaveActionPerformed(evt);
            }
        });
        jPanel4.add(btnSave);
        btnSave.setBounds(110, 50, 70, 23);

        btnAdd.setText("Add");
        btnAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddActionPerformed(evt);
            }
        });
        jPanel4.add(btnAdd);
        btnAdd.setBounds(200, 50, 70, 23);

        jButton7.setText("Del");
        jPanel4.add(jButton7);
        jButton7.setBounds(290, 50, 70, 23);

        jButton8.setText("Cancel");
        jPanel4.add(jButton8);
        jButton8.setBounds(380, 50, 70, 23);

        tbBooth.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        tbBooth.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mousePressed(java.awt.event.MouseEvent evt) {
                tbBoothMousePressed(evt);
            }
        });
        jScrollPane1.setViewportView(tbBooth);

        javax.swing.GroupLayout pnContentLayout = new javax.swing.GroupLayout(pnContent);
        pnContent.setLayout(pnContentLayout);
        pnContentLayout.setHorizontalGroup(
            pnContentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnContentLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnContentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnContentLayout.createSequentialGroup()
                        .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, 170, Short.MAX_VALUE)
                        .addGap(10, 10, 10)
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 438, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(jPanel4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 618, Short.MAX_VALUE)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 618, Short.MAX_VALUE))
                .addContainerGap())
        );
        pnContentLayout.setVerticalGroup(
            pnContentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnContentLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pnContentLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, 363, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout pnBackgroundLayout = new javax.swing.GroupLayout(pnBackground);
        pnBackground.setLayout(pnBackgroundLayout);
        pnBackgroundLayout.setHorizontalGroup(
            pnBackgroundLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnBackgroundLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnContent, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
        pnBackgroundLayout.setVerticalGroup(
            pnBackgroundLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnBackgroundLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pnContent, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(12, Short.MAX_VALUE))
        );

        getContentPane().add(pnBackground, java.awt.BorderLayout.CENTER);

        getAccessibleContext().setAccessibleParent(null);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jList1MousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jList1MousePressed
        // TODO add your handling code here:
        String nameOfEx = (String) jList1.getSelectedValue();
        //settext for textfiel search
        txtSearch.setText(nameOfEx);
        loadBooth(nameOfEx);
}//GEN-LAST:event_jList1MousePressed

    private void txtSearchKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtSearchKeyReleased
        // TODO add your handling code here:
        String name = txtSearch.getText();
        listExhibitor = BoothMag.filterExhibitor(name);
        displayExhibitor();
}//GEN-LAST:event_txtSearchKeyReleased

    private void btnPrevActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPrevActionPerformed
        // TODO add your handling code here:
        if (index > 0) {
            //Display a Zone
            displayObject(--index);
        }
}//GEN-LAST:event_btnPrevActionPerformed

    private void btnNextActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNextActionPerformed
        // TODO add your handling code here:
        if (index + 1 < listBooth.size()) {
            //Display a Zone
            displayObject(++index);
        }
    }//GEN-LAST:event_btnNextActionPerformed

    private void btnSaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveActionPerformed
        //gettext from textfiels
        if (checkEmpty() == false) {
            JOptionPane.showMessageDialog(this, "a TextField is Empty!!!");
            return;
        }
        String id = txtID.getText();
        String name = txtName.getText();
        String sponsor = txtSponsor.getText();
        String dateCreate = txtDateCreate.getText();
        float moneyService = Float.parseFloat(txtMoneyService.getText());
        int priority = cbPriority.getSelectedIndex();
        int numberStaff = Integer.parseInt(txtNumberStaff.getText());
        String idExhibitor = BoothMag.getID(nameExhibitor);

        Booth boo = new Booth(id, name, idExhibitor, _idZone, sponsor, moneyService, priority, numberStaff, dateCreate);
        if (flag) {
            BoothMag.insert(boo);
            flag = false;
        } else {            
            BoothMag.update(boo);
        }

        loadBooth(nameExhibitor);
    }//GEN-LAST:event_btnSaveActionPerformed

    /**
     * When button add was be preed
     * @param evt
     */
    private void btnAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddActionPerformed
        //call method clearText()
        clearText();
        //method createID automatic create new id
        String id = BoothMag.createID();
        txtID.setText(id);
        //call method create name
        String name = "";
        if (listZone.size() > 0) {
            name = BoothMag.createName(listZone.get(0));
            rdZone[0].setSelected(true);
        }
        txtName.setText(name);
        //call method get today
        String today = DateUtility.today();
        txtDateCreate.setText(today);
        flag = true;
}//GEN-LAST:event_btnAddActionPerformed

    private void tbBoothMousePressed(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbBoothMousePressed
        // TODO add your handling code here:
        index = tbBooth.getSelectedRow();
        displayObject(index);
    }//GEN-LAST:event_tbBoothMousePressed

    /**
     * load list zone from database and display on panel
     */
    public void initZone() {
        listZone = BoothMag.loadZone();
        int numberZone = listZone.size();
        _idZone = listZone.get(0).getIDzone();
        //if numberZone > 4, set pnZone scroll
        if (numberZone > 4) {
            pnZone.setPreferredSize(new Dimension(300, numberZone * 30));
        }

        JPanel[] pnPanel = new JPanel[numberZone];
        rdZone = new JRadioButton[numberZone];
        for (int i = 0; i < numberZone; i++) {
            Zone zone = listZone.get(i);

            pnPanel[i] = new JPanel(null);
            rdZone[i] = new JRadioButton(zone.getName());
            grZone.add(rdZone[i]);//add into group radiobutton
            //Create labels
            JLabel amount = new JLabel("" + zone.getNumberBooth());
            JLabel size = new JLabel(zone.getSize());
            JLabel money = new JLabel(zone.getMoney() + "");
            //add labels into panel
            pnPanel[i].add(rdZone[i]);
            pnPanel[i].add(size);
            pnPanel[i].add(money);
            pnPanel[i].add(amount);
            //setbound for labels
            rdZone[i].setBounds(0, 0, 50, 25);
            size.setBounds(80, 0, 50, 25);
            money.setBounds(150, 0, 50, 25);
            amount.setBounds(250, 0, 50, 25);
            rdZone[i].addMouseListener(this);

            pnZone.add(pnPanel[i]);
            pnPanel[i].setBounds(0, 25 * i, 300, 25);
        }
    }

    /**
     * load list exhibitor from database and display in jlist
     */
    public void displayExhibitor() {

        Vector<String> listName = new Vector<String>();
        for (Exhibitor ex : listExhibitor) {
            listName.add(ex.getName());
        }
        //set data for list
        jList1.setListData(listName);
        //set selected index
        jList1.setSelectedIndex(0);
        //load Booths of this Exhibitor
        if (listName.size() > 0) {
            loadBooth(listName.get(0));
        }

    }

    /**
     * get booth by index in array and
     * display booth on textfields
     * @param index is index of a booth in array
     */
    private void displayObject(int index) {
        Booth b = BoothMag.getByIndex(index);

        //set values for textfiels
        txtDateCreate.setText(b.getDateCreate());
        txtID.setText(b.getId());
        txtMoneyService.setText("" + b.getMoneyService());
        txtName.setText(b.getName());
        txtNumberStaff.setText("" + b.getNumberStaff());
        txtSponsor.setText(b.getSponsor());
        cbPriority.setSelectedIndex(b.getPriority());
        //set selected zone
        String idZone = b.getIdZone();
        for (int i = 0; i < listZone.size(); i++) {
            Zone zone = listZone.get(i);
            if (zone.getIDzone().equalsIgnoreCase(idZone)) {
                rdZone[i].setSelected(true);
            }
        }
    }

    /**
     * load list booth folow by idExhibitor was be take from
     * name of Exhibitor
     * @param nameExhibitor used to get idExhibitor
     */
    public void loadBooth(String nameExhibitor) {
        model = new DefaultTableModel(null, new Object[]{"IDBooth", "Name", "Sponsor", "NumberStaff", "Priority", "Money Service", "Date Create"});
        tbBooth.setModel(model);

        listBooth = BoothMag.loadBooth(nameExhibitor);
        this.nameExhibitor = nameExhibitor;
        for (Booth b : listBooth) {
            Vector rowData = new Vector();
            rowData.add(b.getId());
            rowData.add(b.getName());
            rowData.add(b.getSponsor());
            rowData.add(b.getNumberStaff());
            rowData.add(b.getPriority());
            rowData.add(b.getMoneyService());
            rowData.add(b.getDateCreate());

            model.addRow(rowData);
        }
        //when loadbooth of a Exhibitor, index = 0
        index = 0;
        if (listBooth.size() > 0) {
            displayObject(index);//Display a booth
        } else {
            clearText();
        }

    }

    /**
     * clear text on textfields
     */
    private void clearText() {
        txtDateCreate.setText("");
        txtID.setText("");
        txtMoneyService.setText("");
        txtNumberStaff.setText("");
        txtSponsor.setText("");
        cbPriority.setSelectedIndex(0);
    }

    /**
     * Check data is correct format, if correct then return true
     * else return false
     * @return a boolean
     */
    public boolean checkEmpty() {
        boolean test = true;
        if (txtID.getText().equals("")) {
            test = false;
        }
        if (txtName.getText().equals("")) {
            test = false;
        }
        if (txtSponsor.getText().equals("")) {
            test = false;
        }
        if (txtMoneyService.getText().equals("")) {
            test = false;
        }
        if (txtNumberStaff.getText().equals("")) {
            test = false;
        }

        return test;
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAdd;
    private javax.swing.JButton btnNext;
    private javax.swing.JButton btnPrev;
    private javax.swing.JButton btnSave;
    private javax.swing.JComboBox cbPriority;
    private javax.swing.ButtonGroup grZone;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton7;
    private javax.swing.JButton jButton8;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JList jList1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JPanel pnBackground;
    private javax.swing.JPanel pnContent;
    private javax.swing.JPanel pnZone;
    private javax.swing.JTable tbBooth;
    private javax.swing.JTextField txtDateCreate;
    private javax.swing.JTextField txtID;
    private javax.swing.JTextField txtMoneyService;
    private javax.swing.JTextField txtName;
    private javax.swing.JTextField txtNumberStaff;
    private javax.swing.JTextField txtSearch;
    private javax.swing.JTextField txtSponsor;
    // End of variables declaration//GEN-END:variables

    @Override
    public void mouseClicked(MouseEvent e) {
    }

    @Override
    public void mousePressed(MouseEvent e) {
        JRadioButton rb = (JRadioButton) e.getSource();

        for (int i = 0; i < listZone.size(); i++) {
            if (rdZone[i].equals(rb)) {
                String name = BoothMag.createName(listZone.get(i));
                txtName.setText(name);
                _idZone = listZone.get(i).getIDzone();
            }
        }
    }

    public void mouseReleased(MouseEvent e) {
    }

    public void mouseEntered(MouseEvent e) {
    }

    public void mouseExited(MouseEvent e) {
    }
}
